import 'package:flutter/material.dart';
import 'package:flutter_trip/model/common_model.dart';

class LocalNav2 extends StatelessWidget {

  const LocalNav2({Key? key, required this.localNavList}) : super(key: key);

  final List<CommonModel> localNavList;
  @override
  Widget build(BuildContext context) {
    return Container(
      height: 80,
      decoration: BoxDecoration(color: Colors.white , borderRadius: BorderRadius.all(Radius.circular(7))),
      child: Padding(
        padding: EdgeInsets.all(8),
        child: _items(context),
      ),
    );
  }

  _items(BuildContext context) {
    List<Widget> items =[];
    if(localNavList == null){
      return items;
    }

    localNavList.forEach((element) {
        items.add(_item(context , element));
    });

    return Row(
      mainAxisAlignment: MainAxisAlignment.spaceBetween,
      children: items,
    );
  }

  _item(BuildContext context, CommonModel element) {
    return Column(
      children: [
        Image.network(element.icon! , height: 38, width: 38,fit: BoxFit.fill,),
        Text(element.title!,style: TextStyle(fontSize: 14),),
      ],
    );
  }
}
